From 160d3e8f3bc8dd485fde7720dd33ea18a8b73389 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 1 Jul 2018 09:26:10 -0600 Subject: [PATCH] remove more unnecessary const_casting. --- cst.cc | 4 ++-- mmo.cc | 4 ++-- raymarine.cc | 4 ++-- stmsdf.cc | 12 ++++++------ unicsv.cc | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cst.cc b/cst.cc index 27f1fb735..be13a32ff 100644 --- a/cst.cc +++ b/cst.cc @@ -50,7 +50,7 @@ arglist_t cst_args[] = { /* helpers */ static void -cst_add_wpt(const route_head* track, Waypoint* wpt) +cst_add_wpt(route_head* track, Waypoint* wpt) { if ((wpt == nullptr) || (track == nullptr)) { return; @@ -69,7 +69,7 @@ cst_add_wpt(const route_head* track, Waypoint* wpt) } route_add_wpt(temp_route, new Waypoint(*wpt)); } - track_add_wpt(const_cast(track), wpt); + track_add_wpt(track, wpt); } static char* diff --git a/mmo.cc b/mmo.cc index 6b4a2fae4..9176594d1 100644 --- a/mmo.cc +++ b/mmo.cc @@ -78,7 +78,7 @@ static uint16_t ico_object_id; static uint16_t pos_object_id; static uint16_t txt_object_id; static gpsdata_type mmo_datatype; -static route_head* mmo_rte; +static const route_head* mmo_rte; static QHash category_names; static QHash icons; @@ -1337,7 +1337,7 @@ mmo_write_rte_head_cb(const route_head* rte) return; } - mmo_rte = const_cast(rte); + mmo_rte = rte; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { Waypoint* wpt = (Waypoint*)elem; diff --git a/raymarine.cc b/raymarine.cc index b31be2f0a..0efc1aa0b 100644 --- a/raymarine.cc +++ b/raymarine.cc @@ -317,13 +317,13 @@ register_waypt(const Waypoint* ref, const char) static void enum_waypt_cb(const Waypoint* wpt) { - register_waypt(const_cast(wpt), 0); + register_waypt(wpt, 0); } static void enum_rtept_cb(const Waypoint* wpt) { - register_waypt(const_cast(wpt), 1); + register_waypt(wpt, 1); } static int diff --git a/stmsdf.cc b/stmsdf.cc index fd76f2cb3..6aa568eaa 100644 --- a/stmsdf.cc +++ b/stmsdf.cc @@ -61,8 +61,8 @@ static queue trackpts; static QString rte_name; static QString rte_desc; -static Waypoint* trkpt_out; -static route_head* trk_out; +static const Waypoint* trkpt_out; +static const route_head* trk_out; static double trkpt_dist; static double minalt, maxalt, maxspeed; @@ -509,7 +509,7 @@ any_hdr_calc_cb(const route_head* trk) rte_desc = trk->rte_desc; } - trk_out = const_cast(trk); + trk_out = trk; } static void @@ -544,7 +544,7 @@ any_waypt_calc_cb(const Waypoint* wpt) this_time += (wpt->GetCreationTime().toTime_t() - trkpt_out->GetCreationTime().toTime_t()); } - trkpt_out = const_cast(wpt); + trkpt_out = wpt; } static void @@ -566,7 +566,7 @@ track_disp_hdr_cb(const route_head* trk) { track_index++; track_points = 0; - trk_out = const_cast(trk); + trk_out = trk; trkpt_out = nullptr; } @@ -630,7 +630,7 @@ track_disp_wpt_cb(const Waypoint* wpt) gbfprintf(fout, ",0\n"); } - trkpt_out = const_cast(wpt); + trkpt_out = wpt; } static void diff --git a/unicsv.cc b/unicsv.cc index 55b79acd0..a7a57772f 100644 --- a/unicsv.cc +++ b/unicsv.cc @@ -462,7 +462,7 @@ unicsv_adjust_time(const time_t time, time_t* date) static char unicsv_compare_fields(const char* s, const field_t* f) { - char* name = const_cast(f->name); + const char* name = f->name; const char* test = s; char result; -- 2.30.2